package com.lxq.scmserver.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.advisor.api.AdvisedRequest;
import org.springframework.ai.chat.client.advisor.api.AdvisedResponse;
import org.springframework.ai.chat.client.advisor.api.StreamAroundAdvisor;
import org.springframework.ai.chat.client.advisor.api.StreamAroundAdvisorChain;
import reactor.core.publisher.Flux;

/**
 * @description:
 * @author: LuoXiaoQiang
 * @date: 5/9/2025 9:51 PM
 * Copyright (c) 2025, LXQ Cloud All Rights Reserved.
 */
@Slf4j
public class LoggingAdvisor implements StreamAroundAdvisor {


    @Override
    public Flux<AdvisedResponse> aroundStream(AdvisedRequest advisedRequest, StreamAroundAdvisorChain chain) {
        log.info("Request: {}", advisedRequest);
        return chain.nextAroundStream(advisedRequest);
    }

    @Override
    public int getOrder() {
        return 0;
    }

    @Override
    public String getName() {
        return this.getClass().getName();
    }
}
